﻿using System;

namespace _1266_minimum_time_visiting_all_points
{
    class Program
    {
        static void Main (string[] args)
        {
            int[][] points = new int[2][];
            points[0] = new int[2] { 3, 2 };
            points[1] = new int[2] { -2, 2 };
            //points[0] = new int[2] { 1, 1 };
            //points[1] = new int[2] { 3, 4 };
            //points[2] = new int[2] { -1, 0 };

            Console.WriteLine (MinTimeToVisitAllPoints (points));
        }

        public static int MinTimeToVisitAllPoints (int[][] points)
        {
            int count = 0;
            for (int i = 0;i < points.GetLength(0) - 1; i++)
            {
                count += Math.Abs (points[i][0] - points[i + 1][0]) >
                    Math.Abs (points[i][1] - points[i + 1][1]) ? 
                    Math.Abs (points[i][0] - points[i + 1][0]) : Math.Abs (points[i][1] - points[i + 1][1]);
            }
            return count;
        }
    }
}
